package hl.crazy_java.chapter_18.reflect;

import hl.crazy_java.chapter_18.Person;

/**
 * 
 * @author Liu Huan
 */


public class demo1 {
	
	public static void main(String[] args) throws Exception {
		
		//1、Class.forName("全类名")
		Class cls1 = Class.forName("hl.crazy_java.chapter_18.Person");
		System.out.println("cls1 = " + cls1);
		
		//2、类名.class
		Class cls2 = Person.class;
		System.out.println("cls2 = " + cls2);
		
		//3、对象.getClass()
		Person p = new Person();
		Class cls3 = p.getClass();
		System.out.println("cls3 = " + cls3);
		
		// 此三个对象指向内存中同一处引用
		System.out.println(cls1 == cls2);//true
		System.out.println(cls1 == cls3);//true
		
	}
}
